/*
	Visp is an opensource visual performance application built with Adobe® AIR™.
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
	
	Mike Creighton can be found at http://www.mikecreighton.com	
*/
package com.visp.filters
{
	import flash.display.BitmapData;
	import flash.geom.ColorTransform;
	import com.visp.constants.OutputSize;
	import flash.geom.Point;

	public class FilterBase implements IFilter
	{
		
		protected var _alphaTrans : ColorTransform;
		protected var _source : BitmapData;
		
		public function FilterBase()
		{
			this._alphaTrans = new ColorTransform(1, 1, 1, 0);
		}
		
		public function initialize(sourceBitmapData : BitmapData) : void {
			this._source = sourceBitmapData.clone();
		}
		
		public function updateValue2(value:Number):void	{}
		
		public function updateValue1(value:Number):void {}
		
		public function updateAlpha(value:Number):void
		{
			this._alphaTrans.alphaMultiplier = value;
		}
		
		public function apply(inputBitmapData:BitmapData):void
		{
			if(this._alphaTrans.alphaMultiplier > 0){
				inputBitmapData.draw(this._source, null, this._alphaTrans);
			}
		}
		
		public function destroy():void
		{
			this._source.dispose();
			this._alphaTrans = null;
		}
		
	}
}